package sample.asphalt2.processor
{
	import flash.events.MouseEvent;
	
	import mx.managers.PopUpManager;
	import asphalt2.control.AbstractControl;
	
	public class PopupOpenProcessor
	{
		private var _control:AbstractControl;
		private var _popup:Class;
		private var _modal:Boolean;

		public function PopupOpenProcessor(control:AbstractControl,popup:Class,modal:Boolean=true){
			this._control = control;
			this._popup = popup;
			this._modal = modal;
		}
		
		public function get control():AbstractControl{
			return _control;
		}
		
		public function get popup():Class{
			return _popup;
		}
		
		public function get modal():Boolean{
			return _modal;
		}

		public function handle(e:MouseEvent):void{
			openPopup();
		}
			
		public function openPopup():void{
			PopUpManager.centerPopUp(PopUpManager.createPopUp(_control.UI,_popup,_modal));
		}
	}
}